import axios from '@/request'

export function getRoleListApi(page) {
  return axios.get(`/admin/role/${page}`)
}

export function createRoleApi(data) {
  return axios.post('/admin/role', data)
}

export function updateRoleApi(id, data) {
  return axios.post('/admin/role/' + id, data)
}

export function deleteRoleApi(id) {
  return axios.post(`/admin/role/${id}/delete`)
}

export function updateRoleStatusApi(id, status) {
  return axios.post(`/admin/role/${id}/update_status`, {
    status,
  })
}

export function setRoleRulesApi(id, rule_ids) {
  return axios.post(`/admin/role/set_rules`, {
    id,
    rule_ids,
  })
}
